package com.sdry.service.impl.report;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sdry.mapper.hpf.BomMapper;
import com.sdry.mapper.workplace.OthersMapper;
import com.sdry.model.hpf.Bom;
import com.sdry.model.hpf.LineSideLibrary;
import com.sdry.model.hpf.LineSideLibraryOut;
import com.sdry.model.hpf.Part;
import com.sdry.model.hpf.Product;
import com.sdry.model.llm.EmployeeRecord;
import com.sdry.model.llm.TeamRecord;
import com.sdry.model.lz.DeviceBreakdown;
import com.sdry.service.report.ReportServise;
import com.sdry.utils.DateCalculationUtil;

/**
 * 
 * @ClassName:ReportServiceImp
 * @Description:
 * @Author tdd
 * @Date 2019年1月10日下午6:13:30
 * @version 1.0
 */

@Service
public class ReportServiceImp implements ReportServise{
	@Resource
	private BomMapper bomMapper;   //注入BOM mapper
	@Resource
	private OthersMapper othersMapper;

	@Override
	public List<Part> listAllPartByProduct(Product product) {
		List<Part> parts = bomMapper.listAllPartByProduct(product);
		List<Bom> boms = bomMapper.getBomByPid(product.getPid());
		for(Part p : parts){
			for(Bom b : boms){
				if(p.getPaid() == b.getPaid()){
					p.setParemark3(b.getNumber()+"");
				}
			}
		}
		DateCalculationUtil.sort(parts, "paremark4", true);
		return parts;
	}

	@Override
	public List<LineSideLibraryOut> listLineSideLibraryOutByMution(
			LineSideLibraryOut libraryOut) {
		return othersMapper.listLineSideLibraryOutByMution(libraryOut);
	}

	@Override
	public List<TeamRecord> teamRecordByMution(TeamRecord record) {
		return othersMapper.teamRecordByMution(record);
	}

	@Override
	public List<EmployeeRecord> employeeRecordByMution(EmployeeRecord record) {
		return othersMapper.employeeRecordByMution(record);
	}

	@Override
	public List<DeviceBreakdown> deviceBreakdownByMution(DeviceBreakdown record) {
		return othersMapper.deviceBreakdownByMution(record);
	}

	@Override
	public List<LineSideLibrary> lineSideLibraryByMution(LineSideLibrary record) {
		return othersMapper.lineSideLibraryByMution(record);
	}
}
